#ifndef LETTEREDIT_H
#define LETTEREDIT_H

#include <QLineEdit>
#include <QMenu>
#include <QFocusEvent>
#include <QRegExpValidator>


#include "config.h"

class LetterEdit : public QLineEdit
{
		Q_OBJECT

	private:
		QMenu m_menu;

		static QString m_allowedCars () { return " ABCDEFGHIJKLMNOPQRSTUVWXYZ"; }
		static QString m_emptyDisplay () { return QString (Config::m_blankDisplay); }

		void initMenu ();

	public:
		explicit LetterEdit (QWidget *parent);
		~LetterEdit  ();
		QChar letter ();
		void mousePressEvent (QMouseEvent * /*event*/) { selectAll (); }

	signals:
		void letterChanged (const QChar& letter);

	public slots:
		void onTextEdited (const QString& txt);
		void clear () { setText (QString (Config::m_blankDisplay)); }
		void setLetter (const QChar& letter);
		void onCustomContextMenuRequested (const QPoint &pos);
};

#endif // LETTEREDIT_H
